﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using ExtAspNet;
using Ylh.BLL;

public partial class Module_NoteManger_NoteManger : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BtnAdd.OnClientClick = Window1.GetShowReference("NoteDetail.aspx", "新增公告");

        if (!IsPostBack)
        {
            LoadGvlist();
        }
    }

    private void LoadGvlist()
    {
        Ylh.BLL.NoteBLL bll = new NoteBLL(DbConnectionStr);
        Grid1.DataSource = bll.GetList("");
        Grid1.DataBind();
    }

    protected void Window1_Close(object sender, WindowCloseEventArgs e)
    {
       LoadGvlist();
    }



    protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
    {
        System.Web.UI.WebControls.LinkButton lbf = (System.Web.UI.WebControls.LinkButton)Grid1.Rows[e.RowIndex].FindControl("LinkButton1");
      
        string str = Grid1.DataKeys[e.RowIndex][0].ToString();
        lbf.OnClientClick = Window1.GetShowReference("NoteDetail.aspx?NoteID=" + str, "修改公告");
    }


    protected void BtnDel_Click(object sender, EventArgs e)
    {
        List<string> li =base.GetCheckID(Grid1);

        Ylh.BLL.NoteBLL noteBLL = new NoteBLL(DbConnectionStr);
        noteBLL.Delete(li);

        LoadGvlist();
    }
}